﻿<%@ WebHandler Language="C#" Class="SYS_Category_del" %>

using System;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.SessionState;

public class SYS_Category_del : IHttpHandler,IRequiresSessionState {
    sqlhelp sql = new sqlhelp();
    result result = new result();
    string str = "";
    public void ProcessRequest (HttpContext context) {
        try
        {
            if (context.Session["comid"] == null)
            {
                result.code = "-1";
                result.msg = "用户未登录";
                unit.send(context, result);
                return;
            }

            string Id = "";
            if (context.Request["Id"] != null)
            {
                Id = context.Request["Id"].ToString();
            }
            else {
                result.code = "0";
                result.msg = "未传递ID";
                unit.send(context, result);
                return;
            }
            
            str = "update SYS_Category set Enable = 0 where ID = '" + Id + "'";
            if (sql.ExecuteNonQuery(str) > 0)
            {
                result.code = "1";
                result.msg = "";
            }
            else
            {
                result.code = "0";
                result.msg = "删除失败";
            }

        }
        catch (Exception e1)
        {
            result.code = "0";
            result.msg = e1.Message;
        }
        unit.send(context, result);
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}
